package com.yanqu.road.server.cmd.activity.douluodalu;

import com.yanqu.road.pb.activity.douluodalu.DouLuoDaLuProto;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.douluodalu.CrossDouLuoDaLuMgr;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_DOU_LUO_DA_LU_EXPLORE, desc = "探索")
public class CrossDouLuoDaLuExploreCmd extends CrossUnionCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        DouLuoDaLuProto.DouLuoDaLuExploreCrossReqMsg reqMsg = DouLuoDaLuProto.DouLuoDaLuExploreCrossReqMsg.parseFrom(packet.getBytes());
        long stoneNum = 0;
        if (reqMsg.hasStoneNum()) {
            stoneNum = reqMsg.getStoneNum();
        }
        long lowBoxConsumeCount = 0;
        if (reqMsg.hasLowBoxConsumeCount()) {
            lowBoxConsumeCount = reqMsg.getLowBoxConsumeCount();
        }
        long highBoxConsumeCount = 0;
        if (reqMsg.hasHighBoxConsumeCount()) {
            highBoxConsumeCount = reqMsg.getHighBoxConsumeCount();
        }
        MessageHelper.sendPacket(serverId, packet.getPlayerId(), YanQuMessageUtils.buildMessage(Protocol.S_DOU_LUO_DA_LU_EXPLORE_FROM_CROSS,
                CrossDouLuoDaLuMgr.explore(reqMsg.getActivityId(), packet.getPlayerId(), stoneNum, lowBoxConsumeCount, highBoxConsumeCount)));
    }

    @Override
    public void sendData() {

    }
}
